using UnityEngine;

public class PlayerHealth : MonoBehaviour
{
    [Header("Settings")]
    [SerializeField] private int maxHealth;
    private int health;
    void Start()
    {
        health = maxHealth;
    }

    void Update()
    {
        
    }
    
    public void TakeDamage(int damage)
    {
        int realDamage = Mathf.Min(damage, health);
        health -= realDamage;

        Debug.Log("当前血量：" + health);
        if (health <= 0)
        {
            PassAway();
        }
    }

    private void PassAway()
    {
        Debug.Log("死亡！");
    }
    
    
}
